<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>RTW Report - ert_main.c</title>
<link rel="stylesheet" type="text/css" href="rtwreport.css"></link><script language="JavaScript" type="text/javascript" src="rtwreport_utils.js"></script>
<SCRIPT type="text/javascript" language="JavaScript" src="slwebview.js"></SCRIPT>
<SCRIPT type="text/javascript" language="JavaScript" src="id_mapping.js"></SCRIPT>
<SCRIPT type="text/javascript" src="rtwannotate.js"></SCRIPT>
</head>
<body bgcolor="#eeeeee" onload="try {if (top) { if (top.rtwFileOnLoad) top.rtwFileOnLoad(window.document); else local_onload();}} catch(err) {};if (typeof rtwannotate === 'function') {rtwannotate('ert_main_c_cov.xml');}">
<p>
<table border="0" cellspacing="0" cellpadding="6" width="100%%" height="100%%"><tr><td width="100%%" valign="top" bgcolor="#ffffff">
<h4>File: <a href="../ert_main.c" target="rtwreport_document_frame" id="linkToText_plain">ert_main.c</a></h4>
<pre id="RTWcode">
<span><a class="LN" name="1">    1   </a><span class="CT">/*</span>
</span><span><a class="LN" name="2">    2   </a><span class="CT"> * File: ert_main.c</span>
</span><span><a class="LN" name="3">    3   </a><span class="CT"> *</span>
</span><span><a class="LN" name="4">    4   </a><span class="CT"> * Code generated for Simulink model 'carrary'.</span>
</span><span><a class="LN" name="5">    5   </a><span class="CT"> *</span>
</span><span><a class="LN" name="6">    6   </a><span class="CT"> * Model version                  : 1.2</span>
</span><span><a class="LN" name="7">    7   </a><span class="CT"> * Simulink Coder version         : 9.0 (R2018b) 24-May-2018</span>
</span><span><a class="LN" name="8">    8   </a><span class="CT"> * C/C++ source code generated on : Sun May 16 00:50:06 2021</span>
</span><span><a class="LN" name="9">    9   </a><span class="CT"> *</span>
</span><span><a class="LN" name="10">   10   </a><span class="CT"> * Target selection: ert.tlc</span>
</span><span><a class="LN" name="11">   11   </a><span class="CT"> * Embedded hardware selection: ARM Compatible-&gt;ARM Cortex</span>
</span><span><a class="LN" name="12">   12   </a><span class="CT"> * Code generation objectives: Unspecified</span>
</span><span><a class="LN" name="13">   13   </a><span class="CT"> * Validation result: Not run</span>
</span><span><a class="LN" name="14">   14   </a><span class="CT"> */</span>
</span><span><a class="LN" name="15">   15   </a>
</span><span><a class="LN" name="16">   16   </a><font color="#992211">#</font><span class="PP">include</span> <font color="#992211">&lt;stddef.h&gt;</font>
</span><span><a class="LN" name="17">   17   </a><font color="#992211">#</font><span class="PP">include</span> <font color="#992211">&lt;stdio.h&gt;</font>                     <span class="CT">/* This ert_main.c example uses printf/fflush */</span>
</span><span><a class="LN" name="18">   18   </a><font color="#992211">#</font><span class="PP">include</span> <font color="#992211">&quot;carrary.h&quot;</font>                   <span class="CT">/* Model's header file */</span>
</span><span><a class="LN" name="19">   19   </a><font color="#992211">#</font><span class="PP">include</span> <font color="#992211">&quot;rtwtypes.h&quot;</font>
</span><span><a class="LN" name="20">   20   </a>
</span><span><a class="LN" name="21">   21   </a><span class="CT">/*</span>
</span><span><a class="LN" name="22">   22   </a><span class="CT"> * Associating rt_OneStep with a real-time clock or interrupt service routine</span>
</span><span><a class="LN" name="23">   23   </a><span class="CT"> * is what makes the generated code "real-time".  The function rt_OneStep is</span>
</span><span><a class="LN" name="24">   24   </a><span class="CT"> * always associated with the base rate of the model.  Subrates are managed</span>
</span><span><a class="LN" name="25">   25   </a><span class="CT"> * by the base rate from inside the generated code.  Enabling/disabling</span>
</span><span><a class="LN" name="26">   26   </a><span class="CT"> * interrupts and floating point context switches are target specific.  This</span>
</span><span><a class="LN" name="27">   27   </a><span class="CT"> * example code indicates where these should take place relative to executing</span>
</span><span><a class="LN" name="28">   28   </a><span class="CT"> * the generated code step function.  Overrun behavior should be tailored to</span>
</span><span><a class="LN" name="29">   29   </a><span class="CT"> * your application needs.  This example simply sets an error status in the</span>
</span><span><a class="LN" name="30">   30   </a><span class="CT"> * real-time model and returns from rt_OneStep.</span>
</span><span><a class="LN" name="31">   31   </a><span class="CT"> */</span>
</span><span><a class="LN" name="32">   32   </a><span class="DT">void</span> <a href="#fcn_rt_OneStep" onclick="if (top) if (top.docHiliteMe) top.docHiliteMe(window, 'fcn_rt_OneStep');" target="_self"><font color="#1122aa">rt_OneStep</font></a>(<span class="DT">void</span>);
</span><span><a class="LN" name="33">   33   </a><span class="DT">void</span> <a name="fcn_rt_OneStep">rt_OneStep</a>(<span class="DT">void</span>)
</span><span><a class="LN" name="34">   34   </a><b>{</b>
</span><span><a class="LN" name="35">   35   </a>  <span class="DT">static</span> <a href="rtwtypes_h.html#type_boolean_T" onclick="if (top) if (top.docHiliteMe) top.docHiliteMe(window, 'type_boolean_T');" target="_self"><font color="#1122aa">boolean_T</font></a> OverrunFlag = false;
</span><span><a class="LN" name="36">   36   </a>
</span><span><a class="LN" name="37">   37   </a>  <span class="CT">/* Disable interrupts here */</span>
</span><span><a class="LN" name="38">   38   </a>
</span><span><a class="LN" name="39">   39   </a>  <span class="CT">/* Check for overrun */</span>
</span><span><a class="LN" name="40">   40   </a>  <span class="KW">if</span> (OverrunFlag) <b>{</b>
</span><span><a class="LN" name="41">   41   </a>    rtmSetErrorStatus(<a href="carrary_c.html#var_carrary_M" onclick="if (top) if (top.docHiliteMe) top.docHiliteMe(window, 'var_carrary_M');" target="_self"><font color="#1122aa">carrary_M</font></a>, <font color="#1122ff">&quot;Overrun&quot;</font>);
</span><span><a class="LN" name="42">   42   </a>    <span class="KW">return</span>;
</span><span><a class="LN" name="43">   43   </a>  <b>}</b>
</span><span><a class="LN" name="44">   44   </a>
</span><span><a class="LN" name="45">   45   </a>  OverrunFlag = true;
</span><span><a class="LN" name="46">   46   </a>
</span><span><a class="LN" name="47">   47   </a>  <span class="CT">/* Save FPU context here (if necessary) */</span>
</span><span><a class="LN" name="48">   48   </a>  <span class="CT">/* Re-enable timer or interrupt here */</span>
</span><span><a class="LN" name="49">   49   </a>  <span class="CT">/* Set model inputs here */</span>
</span><span><a class="LN" name="50">   50   </a>
</span><span><a class="LN" name="51">   51   </a>  <span class="CT">/* Step the model */</span>
</span><span><a class="LN" name="52">   52   </a>  <a href="carrary_c.html#fcn_carrary_step" onclick="if (top) if (top.docHiliteMe) top.docHiliteMe(window, 'fcn_carrary_step');" target="_self"><font color="#1122aa">carrary_step</font></a>();
</span><span><a class="LN" name="53">   53   </a>
</span><span><a class="LN" name="54">   54   </a>  <span class="CT">/* Get model outputs here */</span>
</span><span><a class="LN" name="55">   55   </a>
</span><span><a class="LN" name="56">   56   </a>  <span class="CT">/* Indicate task complete */</span>
</span><span><a class="LN" name="57">   57   </a>  OverrunFlag = false;
</span><span><a class="LN" name="58">   58   </a>
</span><span><a class="LN" name="59">   59   </a>  <span class="CT">/* Disable interrupts here */</span>
</span><span><a class="LN" name="60">   60   </a>  <span class="CT">/* Restore FPU context here (if necessary) */</span>
</span><span><a class="LN" name="61">   61   </a>  <span class="CT">/* Enable interrupts here */</span>
</span><span><a class="LN" name="62">   62   </a><b>}</b>
</span><span><a class="LN" name="63">   63   </a>
</span><span><a class="LN" name="64">   64   </a><span class="CT">/*</span>
</span><span><a class="LN" name="65">   65   </a><span class="CT"> * The example "main" function illustrates what is required by your</span>
</span><span><a class="LN" name="66">   66   </a><span class="CT"> * application code to initialize, execute, and terminate the generated code.</span>
</span><span><a class="LN" name="67">   67   </a><span class="CT"> * Attaching rt_OneStep to a real-time clock is target specific.  This example</span>
</span><span><a class="LN" name="68">   68   </a><span class="CT"> * illustrates how you do this relative to initializing the model.</span>
</span><span><a class="LN" name="69">   69   </a><span class="CT"> */</span>
</span><span><a class="LN" name="70">   70   </a><a href="rtwtypes_h.html#type_int_T" onclick="if (top) if (top.docHiliteMe) top.docHiliteMe(window, 'type_int_T');" target="_self"><font color="#1122aa">int_T</font></a> <a name="fcn_main">main</a>(<a href="rtwtypes_h.html#type_int_T" onclick="if (top) if (top.docHiliteMe) top.docHiliteMe(window, 'type_int_T');" target="_self"><font color="#1122aa">int_T</font></a> argc, <span class="DT">const</span> <span class="DT">char</span> *argv[])
</span><span><a class="LN" name="71">   71   </a><b>{</b>
</span><span><a class="LN" name="72">   72   </a>  <span class="CT">/* Unused arguments */</span>
</span><span><a class="LN" name="73">   73   </a>  (<span class="DT">void</span>)(argc);
</span><span><a class="LN" name="74">   74   </a>  (<span class="DT">void</span>)(argv);
</span><span><a class="LN" name="75">   75   </a>
</span><span><a class="LN" name="76">   76   </a>  <span class="CT">/* Initialize model */</span>
</span><span><a class="LN" name="77">   77   </a>  <a href="carrary_c.html#fcn_carrary_initialize" onclick="if (top) if (top.docHiliteMe) top.docHiliteMe(window, 'fcn_carrary_initialize');" target="_self"><font color="#1122aa">carrary_initialize</font></a>();
</span><span><a class="LN" name="78">   78   </a>
</span><span><a class="LN" name="79">   79   </a>  <span class="CT">/* Attach rt_OneStep to a timer or interrupt service routine with</span>
</span><span><a class="LN" name="80">   80   </a><span class="CT">   * period 0.2 seconds (the model's base sample time) here.  The</span>
</span><span><a class="LN" name="81">   81   </a><span class="CT">   * call syntax for rt_OneStep is</span>
</span><span><a class="LN" name="82">   82   </a><span class="CT">   *</span>
</span><span><a class="LN" name="83">   83   </a><span class="CT">   *  rt_OneStep();</span>
</span><span><a class="LN" name="84">   84   </a><span class="CT">   */</span>
</span><span><a class="LN" name="85">   85   </a>  printf(<font color="#1122ff">&quot;Warning: The simulation will run forever. &quot;</font>
</span><span><a class="LN" name="86">   86   </a>         <font color="#1122ff">&quot;Generated ERT main won't simulate model step behavior. &quot;</font>
</span><span><a class="LN" name="87">   87   </a>         <font color="#1122ff">&quot;To change this behavior select the 'MAT-file logging' option.\n&quot;</font>);
</span><span><a class="LN" name="88">   88   </a>  fflush((NULL));
</span><span><a class="LN" name="89">   89   </a>  <span class="KW">while</span> (rtmGetErrorStatus(<a href="carrary_c.html#var_carrary_M" onclick="if (top) if (top.docHiliteMe) top.docHiliteMe(window, 'var_carrary_M');" target="_self"><font color="#1122aa">carrary_M</font></a>) == (NULL)) <b>{</b>
</span><span><a class="LN" name="90">   90   </a>    <span class="CT">/*  Perform other application tasks here */</span>
</span><span><a class="LN" name="91">   91   </a>  <b>}</b>
</span><span><a class="LN" name="92">   92   </a>
</span><span><a class="LN" name="93">   93   </a>  <span class="CT">/* Disable rt_OneStep() here */</span>
</span><span><a class="LN" name="94">   94   </a>
</span><span><a class="LN" name="95">   95   </a>  <span class="CT">/* Terminate model */</span>
</span><span><a class="LN" name="96">   96   </a>  <a href="carrary_c.html#fcn_carrary_terminate" onclick="if (top) if (top.docHiliteMe) top.docHiliteMe(window, 'fcn_carrary_terminate');" target="_self"><font color="#1122aa">carrary_terminate</font></a>();
</span><span><a class="LN" name="97">   97   </a>  <span class="KW">return</span> 0;
</span><span><a class="LN" name="98">   98   </a><b>}</b>
</span><span><a class="LN" name="99">   99   </a>
</span><span><a class="LN" name="100">  100   </a><span class="CT">/*</span>
</span><span><a class="LN" name="101">  101   </a><span class="CT"> * File trailer for generated code.</span>
</span><span><a class="LN" name="102">  102   </a><span class="CT"> *</span>
</span><span><a class="LN" name="103">  103   </a><span class="CT"> * [EOF]</span>
</span><span><a class="LN" name="104">  104   </a><span class="CT"> */</span>
</span><span><a class="LN" name="105">  105   </a>
</span></pre>
</td></tr></table>
</p>
</body>
</html>